package nbcp.myoql.db.sql.base

import nbcp.base.db.annotation.Cn
import nbcp.base.db.annotation.DbEntityIndex
import nbcp.base.db.annotation.DbName
import nbcp.myoql.db.sql.annotation.AutoIdColumn
import java.io.Serializable
import java.time.LocalDateTime

open class BaseIdEntity : Serializable {
    var id: String = "";
}

/**
 * 非关系型数据库表基类
 */
open class BaseMarkEntity : BaseIdEntity() {
    @Cn("创建时间")
    var createAt: LocalDateTime = LocalDateTime.now()

    @Cn("更新时间")
    var updateAt: LocalDateTime = LocalDateTime.now()
}


/**
 * 关系型数据库表基础
 */
@DbEntityIndex("id", unique = true)
@AutoIdColumn("id")
abstract class BaseSqlMarkEntity : BaseIdEntity() {

    @Cn("创建时间")
    @DbName("create_at")
    var create_at: LocalDateTime = LocalDateTime.now()

    @Cn("更新时间")
    @DbName("update_at")
    var update_at: LocalDateTime = LocalDateTime.now()
}